package ar.com.photo_admin.service.assembler

import ar.com.photo_admin.service.dto.*;
import ar.com.photo_admin.domain.*;
import org.apache.commons.lang.NotImplementedException

class EventAssembler extends BaseAssembler {
	
	AlbumAssembler albumAssembler = new AlbumAssembler()
	PhotoAssembler photoAssembler = new PhotoAssembler()
	
	def toBean (entity){
		Event event = entity;
		EventDTO bean = new EventDTO()
		
		bean.name = event.name;
		bean.id = event.id;
		bean.cover = event.coverPhoto != null ? photoAssembler.toBean(event.coverPhoto) : null
		bean.photographer = event.photographer.username
		bean.albums = albumAssembler.toLightWeightBeans(event.albums)
		
		return bean
	}
	
	def toLightWeightBean(entity){
		throw new NotImplementedException()
	}
}
